package top.ryw.ssm2.controller;

import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import springfox.documentation.annotations.ApiIgnore;
import top.ryw.ssm2.pojo.User;
import top.ryw.ssm2.service.UserService;

import javax.annotation.Resource;

@ApiIgnore
@Controller
@RequestMapping("/index")
public class IndexController {
    @Resource
    private UserService userService;

    @RequestMapping("/test")
    @ResponseBody
    @Transactional
    public String test() throws Exception {
        User user = new User();
        user.setUsername("username11");
        user.setPassword("passWord");
        userService.insert(user);
        int d = 3 / 0;
        return "test";

    }
}
